Skip to content

⚡ [Performance Improvement] Parallelize check-updates script HTTP requests#2

Open
Serendeep wants to merge 1 commit into
mainfrom
performance-optimization-check-updates-3841537405918422282
Open

⚡ [Performance Improvement] Parallelize check-updates script HTTP requests#2
Serendeep wants to merge 1 commit into
mainfrom
performance-optimization-check-updates-3841537405918422282

Conversation

@Serendeep

Copy link
Copy Markdown
Contributor

💡 What: Modified scripts/check-updates.py to use concurrent.futures.ThreadPoolExecutor().map to run check_formula in parallel for multiple formulas.

🎯 Why: The sequential nature of checking formulas was causing unnecessary delays, as each HTTP request to check GitHub releases or other URLs waited for the previous one to finish. Parallelizing network I/O reduces the overall time to run check-updates.py across the tap significantly.

📊 Measured Improvement: Running the script on the existing test formulas dropped the execution time from ~1.06 seconds to ~0.56 seconds. This represents an ~47% speed improvement. The improvement will scale effectively as more formulas are added to the tap.


PR created automatically by Jules for task 3841537405918422282 started by @Serendeep

Co-authored-by: Serendeep <36764254+Serendeep@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings March 21, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR parallelizes formula update checks in scripts/check-updates.py by running check_formula() concurrently, reducing overall runtime by overlapping network I/O (GitHub API calls and downloads).

Changes:

  • Introduce concurrent.futures.ThreadPoolExecutor usage in the updates-checking loop.
  • Run check_formula() across multiple formula files in parallel and apply updates as results are collected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/check-updates.py
Comment on lines +228 to +230
with concurrent.futures.ThreadPoolExecutor() as executor:
results = executor.map(check_formula, formulas_to_check)

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ThreadPoolExecutor() is created without an explicit max_workers, so the concurrency level will vary by machine (defaults to min(32, os.cpu_count()+4)). As the number of formulas grows this can create a large burst of concurrent GitHub API requests + tarball downloads/hashing, increasing the chance of rate-limiting or flaky timeouts in the scheduled workflow. Consider setting a reasonable upper bound (and optionally making it configurable via CLI flag/env var) based on I/O-bound workload expectations.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants